package Test;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class Test2 {
	
	
	
	public static int getDays(Integer year,Integer month){
		 Calendar c = Calendar.getInstance(); 
		 c.set(Calendar.YEAR, year);  
	     c.set(Calendar.MONTH, month-1);
	     return c.getActualMaximum(Calendar.DAY_OF_MONTH);
	}
	
	public static float getJsIncome(int pricetype,float price,int year,int month){
		float realprice=0;
		switch (pricetype) {
		case 0://日单价
			realprice=price*getDays(year, month);
			break;

		default:
			realprice=price;
			break;
		}
		return realprice;
			
	}
	
	public static void main(String[] args) {
		List<Map<String, Object>> list=new ArrayList();
		
		Map map1=new HashMap<>();
		map1.put("1", 1);
		map1.put("2", 1);
		map1.put("3", 1);
		Map map2=new HashMap<>();
		map2.put("1", 10);
		map2.put("2", 10);
		map2.put("3", 10);
		list.add(map1);
		list.add(map2);
		
		for (Map<String, Object> map : list) {
			
			Set<String> keys = map.keySet();
			for (String str : keys) {
				if(str.equals("1")){
					System.out.print("1月 "+getJsIncome(0, Float.valueOf(map.get(str).toString()), 2017, 1));
					System.out.println();
				}
				if(str.equals("2")){
					System.out.print("2月 "+getJsIncome(0, Float.valueOf(map.get(str).toString()), 2017, 2));
					System.out.println();
				}
				if(str.equals("3")){
					System.out.print(" 3月 "+getJsIncome(0, Float.valueOf(map.get(str).toString()), 2017, 3)+"  ");
					System.out.println();
				}
			}
			
			
		}
		 
		
	}

}
